const path = require('path')
const DonePlugin = require('./plugins/DonePlugin')
const AsyncPlugin = require('./plugins/AsyncPlugin')

/**
 * bundle [ˈbʌndl]: 捆，包，扎
 * build [bɪld]: 建筑;建造;创建;开发;逐渐增强
 */
module.exports = {
  mode: 'development',
  entry: './index.js',
  devtool: 'source-map',
  watch: true,
  output: {
    filename: 'build.js',
    path: path.resolve(__dirname, 'dist')
  },
  resolveLoader: {
    modules: ['node_modules', path.resolve(__dirname, 'loaders')]
  },
  module: {
    rules: [
      {
        test: /\.jpg$/,
        use: {
          loader: 'file-loader',
        }
      },
      {
        test: /\.less$/,
        use: ['style-loader', 'css-loader', 'less-loader']
      },
    ]
  },

  plugins: [
    new DonePlugin(),
    new AsyncPlugin(),
  ]
}
